#cs
	Autoit Test de mmo en tile
    Copyright (C) 2010 Jones

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
#ce

#include-once


Opt("GUIOnEventMode",1)

Global $inventory_gui
$open_inventory = 0

#cs -----------------------------------------------------------------------------------
		Ouvre l'inventaire
#ce -----------------------------------------------------------------------------------
Func inventory()
If $open_inventory = 0 Then
;~ 	$win_pos = WinGetPos($title)
;~ 	$inventory_gui = GUICreate("Inventaire",@DesktopWidth*(20/100),@DesktopHeight*(50/100),$win_pos[0]+10,$win_pos[1]+50)
;~ 	GUISetOnEvent($GUI_EVENT_CLOSE, "exit_inventory")
;~ 	GUISetState(@SW_SHOW)

$inventory_gui = GUICreate("Inventaire", @DesktopWidth*(20/100), @DesktopHeight*(50/100), 5,@DesktopHeight*(10/100), -1, BitAND($WS_EX_TOPMOST,$WS_EX_LAYERED))
$parent = WinGetHandle($title)
_SetParent($inventory_gui,$parent)
GUISetOnEvent($GUI_EVENT_CLOSE, "exit_inventory")
;~ $progress = XSkinProgress(180, 400, 100, 10)
WinSetTrans($inventory_gui,"",100)
GUISetState()
$open_inventory = 1
Else
	GUIDelete()
	$open_inventory = 0
EndIf

EndFunc

#cs -----------------------------------------------------------------------------------
		Ferme l'inventaire
#ce -----------------------------------------------------------------------------------
Func exit_inventory()
	GUIDelete($inventory_gui)
	$open_inventory = 0
EndFunc

Func _SetParent($id_child, $h_parent)
    If Not IsHWnd($h_parent) Then $h_parent = HWnd($h_parent)
    If Not IsHWnd($id_child) Then $id_child = GUICtrlGetHandle($id_child)
    If DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $id_child, "hwnd", $h_parent) <> 0 Then
        Return 1
    Else
        seterror(1)
        Return 0
    EndIf
EndFunc